﻿using BussinessObject.ObjectTwo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ProjectHK3.App_Code;
namespace ProjectHK3.Object_One
{
    public partial class ChangePassword : System.Web.UI.Page
    {
        B_Login fx = new B_Login();
        B_ChangePassword ex = new B_ChangePassword();
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    Label2.Text = Session["Admin"].ToString();
                }
            }catch(Exception ex)
            {
                Response.Redirect("../Object One/Login.aspx");
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            TextBox1.Focus();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (fx.checkLogin(Label2.Text.ToString(), TextBox1.Text).ToString() == "True")
            {
                ex.ChangePassword(TextBox2.Text.ToString(), TextBox1.Text.ToString(), Label2.Text.ToString()).ToString();
                Alert.Show("Ok");

            }
            else
            {
                Alert.Show("Fail");
            }
            
        }
    }
}